﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using FeedAntGame.Sprite.Event;

namespace FeedAntGame.Control
{
    class Candy : BaseControl
    {
        TYPE type;

        public enum TYPE { NONE = -1, ORANGE = 0, PEARL}
        /************************************************************************/
        /*                  GET/SET                                                                     */
        /************************************************************************/
        

        internal TYPE Type
        {
            get { return type; }
            set 
            {
                type = value;
                createInstance(sprite.Position);
                
            }
        }

        
        /************************************************************************/
        /*                  Constructor                                                                     */
        /************************************************************************/
        public Candy(Game game, TYPE type, Vector2 position)
            :base(game)
        {
            this.game = game;
            this.type = type;
            createInstance(position);
        }

        protected override void createInstance(Vector2 position)
        {
            switch (type)
            {
                case Candy.TYPE.NONE:
                    sprite = null;
                    break;
                case Candy.TYPE.ORANGE:
                    sprite = new CandySprite(
                        Game.Content.Load<Texture2D>(@"Images\range_circle"),
                        Game.Content.Load<Texture2D>(@"Images\orange_candy_cover"),
                        Game.Content.Load<Texture2D>(@"Images\orange_candy_normal"),
                        Game.Content.Load<Texture2D>(@"Images\orange_candy_cover"),
                        Game.Content.Load<Texture2D>(@"Images\orange_candy_normal"),
                        position, new Point(64, 68), -3, new Point(1, 1), Vector2.Zero, null, 1, type);
                    (sprite as CandySprite).Range = 150;
                    sprite.ScroreValue = 100;
                    (sprite as CandySprite).Power = 50;
                    break;
                case Candy.TYPE.PEARL:
                    sprite = new CandySprite(
                        Game.Content.Load<Texture2D>(@"Images\range_circle"),
                        Game.Content.Load<Texture2D>(@"Images\yellow_candy_cover"),
                        Game.Content.Load<Texture2D>(@"Images\yellow_candy_normal"),
                        Game.Content.Load<Texture2D>(@"Images\yellow_candy_cover"),
                        Game.Content.Load<Texture2D>(@"Images\yellow_candy_normal"),
                        position, new Point(64, 64), -3, new Point(1, 1), Vector2.Zero, null, 1, type);
                    (sprite as CandySprite).Range = 100;
                    sprite.ScroreValue = 50;
                    (sprite as CandySprite).Power = 100;
                    break;

            }
        }
    }
}
